<template>
  <view class="page-body">
   <u-navbar :is-back="false" title="超市付款方式设置"
     title-size="30"
     :background="{background:'#2B88FE' }"
     title-color="#fff">
     <div class="head_icon">
       <u-icon @click="$api.handleBackTo"
         name="arrow-left" color="#fff"
         size="36">
       </u-icon>
       <u-icon @click="$api.handleHomeTo"
         name="home" color="#fff" size="36">
       </u-icon>
     </div>
   </u-navbar>
    <view class="clist x-row">
      <view class="x-col-center cname">
        超市名称：
      </view> {{from.fMrkName}}
        
    </view>
	
	<view class="clist x-row">
	  <view class="x-col-center cname">
	    结算方式：
	  </view>
	   <picker mode="selector" :range="Sizevalue" @change="bindSizeMarket"
	     range-key="ClassName">
	     <div class="boxFlex">
	       {{SizeText}}
	       <u-icon name="arrow-right" color="#999">
	       </u-icon>
	     </div>
	   </picker>
	   
	</view>
	
	<view class="clist x-row">
	  <view class="x-col-center cname">
         结算时间：
	  </view>
	     每月<input type="text" placeholder="每月结算时间" v-model="from.fSumTime" />   
		 <view class="rmb x-col-center">
	    号
	  </view>
	</view>
 
	
	<view class="clist x-row">
	  <view class="x-col-center cname">
	    对账地点：
	  </view>
	  <input placeholder="请输入对账地点" v-model="from.fAddress "  
	    class="x-col x-col-center "></input>
	
	</view>
	
	<view class="clist x-row">
	  <view class="x-col-center cname">
	    收款账户：
	  </view>
	  <input placeholder="请输入收款账户" v-model="from.fAccount "  
	    class="x-col x-col-center "></input>	  
	</view>
	<view class="clist x-row">
	  <view class="x-col-center cname">
	    开户行：
	  </view>
	  <input placeholder="请输入开户行" v-model="from.fBank "  
	    class="x-col x-col-center "></input>	  
	</view>
	
	
	<view class="clist x-row">
	  <view class="x-col-center cname">
	    联系人：
	  </view>
	  <input placeholder="请输入联系人" v-model="from.fContacts"  
	    class="x-col x-col-center "></input> 
	</view>
	<view class="clist x-row">
	  <view class="x-col-center cname">
	    联系电话：
	  </view>
	   <input type="text" placeholder="请输入联系电话" v-model="from.fTell" />
	</view>
 
	
    <view class="h16">

    </view>
    <view class="infos whiteBg">
      <view class="clist x-row ">
        <view class="x-col-center cname" style="width: 300rpx;">
          其他信息
        </view>
      </view>
      <textarea v-model="from.fInfo" class="txt" placeholder="请在此输其他信息…"></textarea>
 
    </view>
    <view :style="{height:height}"></view>
    <view class="viewbbutton" :style="{height:height}">
      <button class="sendBomBtn" @click="submit">提 交</button>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      from: {},
	 
	  SumType:0,
      SizeText: '请选择结算方式',
      Sizevalue: [], //存储超市规模数据
	  start: false, //开始时间
	  clineOnce:true,
	  id: 0,
      header: {
        token: uni.getStorageSync('token')
      },
      height: this.but_height(),
      action: this.urlimg + 'api/Upfile/PostImgFile',
      clist: [],
      isAllList: 1,
      page: 1,
      status: 'loading',
      loading: true
    }
  },
  onLoad(e) {
    uni.setNavigationBarTitle({
      title: '超市付款方式设置'
    })
	 this.id = Number(e.id)
	  

	  
	 this.$axios('api/MrkSumSet/GetDetail', 'post', { value: this.id }).then(res => {
	   this.from = res.Value
	   this.loading = false
	     this.SumType =  this.from.fSumType
	 
	   this.$axios('api/MrkSumSet/GetSumType', 'post', { value: 0 }).then(res => {
	   
	     let info = res.Value.find(x => x.ClassId == this.from.fSumType)
	     this.Sizevalue = res.Value
	     this.SizeText = info.ClassName
	     this.from.fSumType = info.ClassId
	   })
	   
	 })
	 

	 
  },
  methods: {
    // user/submit_apply 			新增报销
    submit() {
		if (!this.clineOnce) return false
		this.clineOnce = false
		 this.from.fMrkId=this.id
    
      this.$axios('api/MrkSumSet/UpdateDetail', 'post', { value: this.from }).then(res => {
		  if (!res.Success) {
		    uni.showToast({
		      title: '提交失败：'+res.Message,
		      icon: 'none',
		      duration: 2000
		    })
		   this.clineOnce = true
		    return false
		  }
		 this.clineOnce = true
        this.$api.handleToUrl('提交成功', '/pages/my_customer/MrkSumSetDetail?id='+this.id)
      })
    },
 
	bindSizeMarket(event) {
	  let info = this.Sizevalue[event.detail.value]
	  this.SizeText = info.ClassName
	   
	  this.from.fSumType = info.ClassId
	}
  }
}
</script>

<style lang="scss">
.clist {
  padding: 34rpx 32rpx;
  box-sizing: border-box;
  background-color: #ffffff;
  .cname {
    width: 164rpx;
    font-size: 32rpx;
    font-weight: 500;
    color: #34404a;
  }

  .rmb {
    font-size: 30rpx;
    font-weight: 400;
    color: #34404a;
  }
}
.infos {
  padding: 0 32rpx;
  .clist {
    padding-left: 0;
    padding-right: 0;
  }
  .txt {
    height: 320rpx;
    background: #f8f9fc;
    border-radius: 16rpx;
    border: 2rpx solid rgba(0, 0, 0, 0.09);
    padding: 22rpx 20rpx;
    box-sizing: border-box;
    width: 100%;
  }
}
.h16 {
  height: 16rpx;
  background-color: #f5f7f9;
}
</style>
